package com.fz.study.project.controller;


import com.fz.study.project.entity.Result;
import com.fz.study.project.service.ITbVoucherOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-02-28
 */
@Tag(name = "抢优惠卷")
@RestController
@RequiredArgsConstructor
@RequestMapping("/voucher-order")
public class VoucherOrderController {

    private final ITbVoucherOrderService voucherOrderService;

    @Operation(summary = "抢优惠券")
    @PostMapping("seckill/{id}")
    public Result seckillVoucher(@PathVariable("id") Long voucherId){
        return Result.success(voucherOrderService.seckillVoucherWithId(voucherId));
    }

}
